/**
 * <copyright>
 * </copyright>
 *

 */
package br.ufrn.dimap.ExperimentDslLanguage.experimentDsl.impl;

import br.ufrn.dimap.ExperimentDslLanguage.experimentDsl.*;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class ExperimentDslFactoryImpl extends EFactoryImpl implements ExperimentDslFactory
{
  /**
   * Creates the default factory implementation.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public static ExperimentDslFactory init()
  {
    try
    {
      ExperimentDslFactory theExperimentDslFactory = (ExperimentDslFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.ufrn.br/dimap/ExperimentDslLanguage/ExperimentDsl"); 
      if (theExperimentDslFactory != null)
      {
        return theExperimentDslFactory;
      }
    }
    catch (Exception exception)
    {
      EcorePlugin.INSTANCE.log(exception);
    }
    return new ExperimentDslFactoryImpl();
  }

  /**
   * Creates an instance of the factory.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ExperimentDslFactoryImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public EObject create(EClass eClass)
  {
    switch (eClass.getClassifierID())
    {
      case ExperimentDslPackage.MODEL: return createModel();
      case ExperimentDslPackage.EXPERIMENT_ELEMENT: return createExperimentElement();
      case ExperimentDslPackage.EXPERIMENTAL_PLAN: return createExperimentalPlan();
      case ExperimentDslPackage.FACTOR: return createFactor();
      case ExperimentDslPackage.LEVELS: return createLevels();
      case ExperimentDslPackage.QUESTIONS: return createQuestions();
      case ExperimentDslPackage.ALTERNATIVES: return createAlternatives();
      default:
        throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
    }
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object createFromString(EDataType eDataType, String initialValue)
  {
    switch (eDataType.getClassifierID())
    {
      case ExperimentDslPackage.DESIGN_TYPE:
        return createDesignTypeFromString(eDataType, initialValue);
      case ExperimentDslPackage.ANSWER_TYPE:
        return createAnswerTypeFromString(eDataType, initialValue);
      default:
        throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
    }
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String convertToString(EDataType eDataType, Object instanceValue)
  {
    switch (eDataType.getClassifierID())
    {
      case ExperimentDslPackage.DESIGN_TYPE:
        return convertDesignTypeToString(eDataType, instanceValue);
      case ExperimentDslPackage.ANSWER_TYPE:
        return convertAnswerTypeToString(eDataType, instanceValue);
      default:
        throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
    }
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Model createModel()
  {
    ModelImpl model = new ModelImpl();
    return model;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ExperimentElement createExperimentElement()
  {
    ExperimentElementImpl experimentElement = new ExperimentElementImpl();
    return experimentElement;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ExperimentalPlan createExperimentalPlan()
  {
    ExperimentalPlanImpl experimentalPlan = new ExperimentalPlanImpl();
    return experimentalPlan;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Factor createFactor()
  {
    FactorImpl factor = new FactorImpl();
    return factor;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Levels createLevels()
  {
    LevelsImpl levels = new LevelsImpl();
    return levels;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Questions createQuestions()
  {
    QuestionsImpl questions = new QuestionsImpl();
    return questions;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Alternatives createAlternatives()
  {
    AlternativesImpl alternatives = new AlternativesImpl();
    return alternatives;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public DesignType createDesignTypeFromString(EDataType eDataType, String initialValue)
  {
    DesignType result = DesignType.get(initialValue);
    if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
    return result;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String convertDesignTypeToString(EDataType eDataType, Object instanceValue)
  {
    return instanceValue == null ? null : instanceValue.toString();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public AnswerType createAnswerTypeFromString(EDataType eDataType, String initialValue)
  {
    AnswerType result = AnswerType.get(initialValue);
    if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
    return result;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String convertAnswerTypeToString(EDataType eDataType, Object instanceValue)
  {
    return instanceValue == null ? null : instanceValue.toString();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ExperimentDslPackage getExperimentDslPackage()
  {
    return (ExperimentDslPackage)getEPackage();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @deprecated
   * @generated
   */
  @Deprecated
  public static ExperimentDslPackage getPackage()
  {
    return ExperimentDslPackage.eINSTANCE;
  }

} //ExperimentDslFactoryImpl
